import java.util.Random;
import java.util.Scanner;
    public class GuessNumber {
        public static void main(String[] args) {
            Scanner reader = new Scanner(System.in);
            Random random = new Random();
            System.out.println("给你一个1到100的整数，猜猜这个数");
            int realNumer = random.nextInt(100)+1;
            int yourGuess= 0;
            System.out.println("输入您的猜测：");
            yourGuess = reader.nextInt();
            while (yourGuess!=realNumer){
                if(yourGuess>realNumer){
                    System.out.println("猜大了，再输入你的猜测");
                    yourGuess = reader.nextInt();
                } else if (yourGuess<realNumer) {
                    System.out.println("猜小了，再输入你的猜测");
                    yourGuess = reader.nextInt();
                }
            }
            System.out.println("恭喜你猜对了");
        }
    }
